//
//  main.m
//  遍历方法
//
//  Created by dllo on 16/5/30.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        NSArray *array = @[@"aaa",@"bbb",@"ccc",@"ddd"];
        
        
        [array  enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            NSLog(@"%ld %@",idx,obj);
            
            
            if(idx == 2){
                *stop = YES;
            }
            
        }];
        
        
        NSDictionary *dict =@{@"1":@"ok",@"2":@"no"};
        
        [dict enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
            NSLog(@"%@ %@",key,obj);
            
            
        }];
        
        NSSet *set = [[NSSet alloc] initWithObjects:@"lijie",@"liyang",@"zhaotangyue", nil];
        
        [set enumerateObjectsUsingBlock:^(id  _Nonnull obj, BOOL * _Nonnull stop) {
            NSLog(@"%@",obj);
        }];
        
        
        
        NSArray *array2 = @[@"234",@"123",@"17",@"768",@"2"];
        
        
        NSSortDescriptor *description = [[NSSortDescriptor alloc] initWithKey:@"self" ascending:YES];
        
        NSArray *returnArray = [array2 sortedArrayUsingDescriptors:@[description]];
        NSLog(@"%@",returnArray);
    
    
    
    }
    return 0;
}
